<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>垂直定位</title>
    <style>
      .div1 {
        position: relative;
        width: 200px;
        height: 200px;
        background-color: paleturquoise;
      }

      .div2 {
        position: absolute;
        top: 50px;
        left: 150px;
        width: 100px;
        height: 100px;
        background-color: palevioletred;

        /* 
          z轴定位方式
          1. 数值可以是正整数、负整数或 0, 默认是 auto，数值越大，盒子越靠上
          2. 如果属性值相同，则按照书写顺序，后来居上
          注意: 只有定位的盒子才有 z-index 属性
        */
        z-index: -1;
      }
    </style>
  </head>
  <body>
    <div class="div1">
      <div class="div2"></div>
    </div>
  </body>
</html>
